package net.monare.mifss;

import com.vaadin.ui.UI;
import net.monare.mifss.services.StorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.stereotype.Component;

/**
 * Created by kristan_uros on 16.4.2014.
 */
@Component
public class MifssHolder {


    @Autowired
    private transient ApplicationContext applicationContext;

    public StorageService getStorageService() {
        return applicationContext.getBean(StorageService.class);
    }


    public SecurityContext getSecurityContext() {

        return ((MifssAdminMainUI) UI.getCurrent()).getSecurityContext();
    }

}
